<?php
trait HelloWorld{
    public function sayHello(){
        echo "Hello world";
    }
}

class myClass{
    use HelloWorld;
    
    use HelloWorld{
        // 修改 sayHello 的访问控制
        sayHello as protected;
    }

}

$new=new myClass();
//$new->sayHello();